<?php
namespace app\atxunda\controller;
use think\Controller;
use think\Db; 
use think\Request;
use think\Cookie;

class Login extends Controller
{

	/**
	 * [logout 退出登录]
	 * @return [type] [description]
	 */
	public function logout(){
		Cookie::delete('admin');
		$this->success('退出成功','login','',1);
	}

	/**
	 * [login 登录]
	 * @return [type] [description]
	 */
	public function login(){
		if(input('post.')){
			$name = input('request.admin_name');
			$password  = input('request.admin_password');
			$check=\app\atxunda\model\Admin::login($name, $password);
			if($check){
				$this->success('登录成功','index/index','','1');
			}else{
				$this->error('用户名或密码错误');
			}
		}else{
			return $this->fetch('login');
		}
	}

}